import React from 'react';
import { Row, Col } from 'antd';
import { MyCalendar } from './children/myCalendar';
import { TodayTimeLine } from './children/todayTimeline';
import { ContentMiddle } from './contentMiddle';

export default class HomeContent extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            iframeSrc: ''// iframe地址
        };
    }

    setRoute(iframeSrc) { // 设置组件路由
        if (iframeSrc.indexOf('http') < 0) {
            this.setState({ iframeSrc });
            this.contentMiddle.changeBread(iframeSrc);
        }
    }

    render() {
        let { current } = this.props,
            { iframeSrc } = this.state;
        return (
            <div>
                {current === 'home'
                    ? (
                        <Row className="mt-20">
                            <Col offset={3} span={14}><MyCalendar /></Col>
                            <Col offset={3} span={4}><TodayTimeLine /></Col>
                        </Row>
                    )
                    : (
                        <Row>
                            <Col span={24}>
                                <ContentMiddle ref={el => this.contentMiddle = el} comp={iframeSrc} />
                            </Col>
                        </Row>
                    )}
            </div>
        )
    }
}
export { HomeContent };